/**
 * Copyright 2008-2009. Fubang Technology , Inc. All rights reserved.
 * <a>http://www.3gcq.cn</a>
 */
package com.fbty.base.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;

import com.fbty.mt.domain.User;
import com.opensymphony.xwork2.ActionSupport;

/**
 * @author liyun create 2009-4-8
 *
 */
/**
 * 定义Action基类 提供 日志打印 获取request,response等方法
 * @author liyun create 2009-3-14
 *
 */
public class BaseAction extends ActionSupport implements SessionAware,ServletRequestAware,ServletResponseAware,RequestAware{

	protected Map<String,Object> sessionMap;
	protected Map<String,Object> requestMap;
	protected HttpServletRequest request;
	protected HttpServletResponse response;
	
	private static final long serialVersionUID = 1L;
	
	
	protected Log logger = LogFactory.getLog(this.getClass());
	
	
	/**
	 * 获取当前session用户
	 * 
	 * @return 当前session用户
	 */
	protected User getUser() {
		User emp = (User)sessionMap.get("user");
		return emp;
		
	}
	@Override
	public void setRequest(Map<String, Object> requestMap) {
		this.requestMap = requestMap;
	}
	@Override
	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}
	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}
	@Override
	public void setSession(Map<String, Object> sessionMap) {
		this.sessionMap = sessionMap;
	}
	
}
